﻿using System;

namespace BrightSword.OfficeInterop
{
    /// <summary>
    /// Use this attribute on a property to specify the text of the header cell corresponding to this property.
    /// </summary>
    /// <example>
    /// Consider an Excel sheet with the following text on the first row:
    /// 
    /// || Form Container | Tab Page Name | Control Name | Combo Value | Menuitem Name | Context Menuitem Name ||
    ///
    /// These values may contain embedded spaces, have alphanumeric and non-alphanumeric characters in them.
    ///
    /// Now, to read those values into a class instance, we might create a class as follows
    /// 
    /// <code>
    ///     internal sealed class UISpecifier
    ///     {
    ///         public string FormContainer { get; set; }
    ///         public string TabPageName { get; set; }
    ///         public string MenuItemName { get; set; }
    ///         public string ControlName { get; set; }
    ///         public string ContextMenuName { get; set; }
    ///     }
    /// </code>
    /// 
    /// The properties may be defined in any order, and with any name. 
    /// This attribute can be used to correlate the properties to the columns as follows
    /// 
    /// <code>
    ///     internal sealed class UISpecifier
    ///     {
    ///         [ColumnHeader("Form Container")]
    ///         public string FormContainer { get; set; }
    ///
    ///         [ColumnHeader("Tab Page Name")]
    ///         public string TabPageName { get; set; }
    ///
    ///         [ColumnHeader("Menuitem Name")]
    ///         public string MenuItemName { get; set; }
    ///
    ///         [ColumnHeader("Control Name")]
    ///         public string ControlName { get; set; }
    ///
    ///         [ColumnHeader("Context Menuitem Name")]
    ///         public string ContextMenuName { get; set; }
    ///     }
    /// </code>
    /// 
    /// </example>
    /// <remarks>
    /// This code is made available for open-source use at http://excelreader.codeplex.com/
    /// </remarks>
    /// <see cref="http://excelreader.codeplex.com/"/>
    [AttributeUsage(AttributeTargets.Property)]
    public class ColumnHeaderAttribute : Attribute
    {
        /// <summary>
        /// Constructor for the attribute with a specified column header text
        /// </summary>
        /// <param name="columnHeaderText">Text used to correlate the Excel sheet column with this property</param>
        public ColumnHeaderAttribute(string columnHeaderText)
        {
            ColumnHeaderText = columnHeaderText;
        }

        public string ColumnHeaderText { get; set; }
    }
}